Skip to content

perf: cache session history with workspace images#20733

Merged
seven332 merged 5 commits into
mainfrom
perf/issue-20732-session-history-sidecar
Jul 9, 2026
Merged

perf: cache session history with workspace images#20733
seven332 merged 5 commits into
mainfrom
perf/issue-20732-session-history-sidecar

Conversation

@seven332

@seven332 seven332 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • cache verified final session-history bytes as a sidecar beside promoted workspace images
  • probe the sidecar on fresh workspace-image hits and restore locally before falling back to R2
  • share sidecar protocol metadata in guest-contracts, cap sidecars at the current 64 MiB copy-file stream limit, and include sidecar bytes in cache GC/inspection accounting

Testing

  • cargo test --manifest-path crates/Cargo.toml -p guest-agent session_history_identity -- --nocapture
  • cargo test --manifest-path crates/Cargo.toml -p runner session_history_sidecar -- --nocapture
  • cargo test --manifest-path crates/Cargo.toml -p runner restore_plan_ -- --nocapture
  • cargo test --manifest-path crates/Cargo.toml -p runner run_in_sandbox_restores_session_history_from_workspace_sidecar -- --nocapture
  • cargo test --manifest-path crates/Cargo.toml -p runner workspace_promotion::tests -- --nocapture
  • cargo check --manifest-path crates/Cargo.toml -p guest-agent -p runner
  • cargo clippy --manifest-path crates/Cargo.toml -p guest-agent -p runner --all-targets -- -D warnings

Closes #20732

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

API preview: https://pr-20733-api.vm6.ai

@seven332 seven332 added this pull request to the merge queue Jul 9, 2026
@seven332

seven332 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Code Review: PR #20733

Summary

Reviewed the runner/guest session-history sidecar cache implementation across 5 commits. The sidecar is modeled as an optional workspace-image-cache optimization, not as a new source of truth. The code validates metadata identity and body file identity before use, verifies hash/size before restore, accounts sidecar bytes in cache GC/inspection, and falls back to remote session history on cache failure.

Key Findings

Critical Issues (P0)

None found.

High Priority (P1)

None found.

Testing Review

Coverage

  • perf: cache verified final session-history bytes beside promoted workspace images -> covered by crates/runner/src/workspace_image_cache/tests/mod.rs, crates/runner/src/workspace_promotion/tests.rs, and guest helper coverage in crates/guest-agent/src/session_history_identity.rs.
  • perf: restore from local sidecar on fresh workspace-image hits -> covered by crates/runner/src/executor/tests/agent_run_tests.rs.
  • fix: verify workspace sidecar content before restore -> covered by corrupted sidecar fallback and Codex zstd restore tests in crates/runner/src/executor/tests/agent_run_tests.rs.
  • fix: prune stale/invalid sidecars and surface prune errors -> covered by crates/runner/src/workspace_image_cache/tests/mod.rs.
  • fix: clean sidecar export temp files -> covered by workspace promotion tests and reviewed cleanup paths.

Convention Compliance

No testing convention violations found. Rust tests use real temp directories/filesystem operations, httpmock for external HTTP, and existing sandbox-mock at the sandbox boundary. No fake timers, active sleeps, internal TS mocks, direct fetch mocks, or filesystem mocks were introduced.

Testing Verdict: Adequate

Bad Smell Analysis

  • Mock violations: 0
  • Direct fetch mocking: 0
  • Filesystem mocking: 0
  • Fake timers / artificial sleeps: 0
  • Type suppressions / lint suppressions: 0
  • Production unwrap / panic: 0
  • Dynamic imports / TypeScript any: 0
  • Defensive fallback misuse: 0

Verification

Reviewed and ran:

git diff --check origin/main...HEAD
cargo test --manifest-path crates/Cargo.toml -p runner session_history_sidecar -- --nocapture
cargo test --manifest-path crates/Cargo.toml -p runner workspace_sidecar -- --nocapture
cargo test --manifest-path crates/Cargo.toml -p runner codex_zstd_sidecar -- --nocapture
cargo clippy --manifest-path crates/Cargo.toml -p runner -p guest-agent --all-targets -- -D warnings
cargo fmt --manifest-path crates/Cargo.toml --all -- --check

All passed.

Recommendations

No changes requested.

Verdict

LGTM.


Full review details: codereviews/20260709/
Testing standards: docs/testing.md

Merged via the queue into main with commit d588e5a Jul 9, 2026
79 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in VM0 Kanban Jul 9, 2026
@github-actions github-actions Bot mentioned this pull request Jul 9, 2026
@github-actions github-actions Bot deleted the perf/issue-20732-session-history-sidecar branch July 9, 2026 04:21
@seven332 seven332 mentioned this pull request Jul 9, 2026
64 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

perf: cache session history alongside workspace image hits

1 participant